import 'package:flutter/material.dart';
import "package:get/get.dart";

class Follow extends StatefulWidget {
  const Follow({super.key});
  @override
  State<Follow> createState() => _HomePageState();
}

class _HomePageState extends State<Follow> with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 3, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          centerTitle: true,
          backgroundColor: Color(0xffffffff),
          leadingWidth: 40,
          leading: IconButton(
            onPressed: () {
              Get.back();
              print('object');
            },
            icon: Image.asset('static/images/back.png'),
          ),
          title: Container(
            width: 270,
            child: TabBar(
              controller: _tabController,
              dividerColor: Colors.transparent,
              indicatorWeight: 3.0,
              indicatorPadding:
                  EdgeInsets.only(bottom: 10, right: 40, left: 40, top: 10),
              labelColor: Color(0xff6A3BD9),
              unselectedLabelColor: Color(0xff999999),
              indicatorSize: TabBarIndicatorSize.tab,
               overlayColor: WidgetStateProperty.all(Colors.transparent),
              tabs: [
                Tab(text: '粉丝'),
                Tab(text: '关注的人'),
                Tab(text: '话题'),
              ],
            ),
          )),
      body: TabBarView(
        controller: _tabController,
        children: [
          // 对应每个 Tab 的内容
          // fans(),
          // fans(),
          // fans(),
        ],
      ),
    );
  }
}

Widget fans() {
  return Container(
    margin: EdgeInsets.only(left: 15, right: 15, top: 30),
    child: Row(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        CircleAvatar(
          radius: 22,
          backgroundImage: AssetImage('static/aaa.png'), // 替换为你的静态图片路径
        ),
        SizedBox(width: 10), // 添加间距
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '啊呜严选啊呜严选',
                style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
              ),
              SizedBox(height: 2), // 添加间距
              Text(
                '关注了你 07-25',
                style: TextStyle(color: Colors.grey,fontSize: 12,),
              ),
            ],
          ),
        ),
        SizedBox(width: 10), // 添加间距
        GestureDetector(
          onTap: () {
            // 处理互关逻辑
            print('互关按钮被点击');
          },
          child: Container(
            margin: EdgeInsets.only(top:10),
            padding: EdgeInsets.symmetric(horizontal: 15, vertical: 5),
            decoration: BoxDecoration(
              color: Colors.grey[200],
              borderRadius: BorderRadius.circular(20),
            ),
            child: Text(
              '互关',
              style: TextStyle(color: Colors.black,fontSize: 12,),
            ),
          ),
        ),
      ],
    ),
  );
}
